import React, { Component } from 'react'
import { connect } from 'dva'
import { Link } from 'dva/router'
import './index.less'
class Index extends Component {
  handleClick() {
    const { dispatch } = this.props
    let { num } = this.props.init
    console.log(history)
    dispatch({
      type: 'init/save',
      payload: {
        num: ++num
      }
    })
  }
  render() {
    const { init } = this.props
    return (
      <div> <Link to="/asd">跳转到two component</Link><br />
        <img src="/pubcli" alt="" />
        <a href="javascript:;" onClick={(e) => this.handleClick(e)}>增加</a>
        <span>init.sdfsdf: {init.num}</span>
      </div>
    )
  }
}

const mapStateToProps = ({ init }) => ({ init })
export default connect(mapStateToProps)(Index)